@rem bat scripts for stack analysis
@echo off

@rem start local scope for environment variables
:local_scope_start
if "%OS%"=="Windows_NT" setlocal

set HOME=%~dp0
if "%HOME%" == "" set HOME=.\
set SCRIPT_HOME=%HOME%scripts\
set NODE_HOME=%HOME%node\

@rem check node is available
%NODE_HOME%node -v >nul 2>nul
if "%errorlevel%" equ "9009" (
  echo Node.js is not available. Please ensure that Node.js is available. 
  goto local_scope_end
) else (
  goto analyze
)

:analyze
set HSTACK=%SCRIPT_HOME%hstack\lib\index.js
@rem run hstack
%NODE_HOME%node %HSTACK% %*

@rem endlocal scope for environment variables
:local_scope_end
if "%OS%"=="Windows_NT" endlocal